package excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.Map;

/**
 * @author chenwenhao
 * @version 1.0.0
 * @ClassName ExcelListener.java
 * @Description TODO
 * @createTime 2020/11/29,16:45
 */
public class ExcelListener extends AnalysisEventListener<ExcelData> {

    /**
     * 逐行读取
     *
     * @param excelData       excel数据
     * @param analysisContext 分析内容
     */
    @Override
    public void invoke(ExcelData excelData, AnalysisContext analysisContext) {
        System.out.println("***"+excelData);
    }

    /**
     * 读取表头
     *
     * @param headMap 头图
     * @param context 内容
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头:"+headMap);
        super.invokeHeadMap(headMap, context);
    }

    /**
     * 全部读取后
     *
     * @param analysisContext 分析内容
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("全部读取。。");
    }
}
